package com.cgbl.cg.adapter

import android.os.Bundle
import com.cgbl.cg.R
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.robot.base.configs.AppConstants
import com.robot.base.model.WorksBean
import com.robot.base.util.arouter.ARouterUtil
import com.robot.base.utils.pic.ImageLoaderUtils

class CollectionsDetailsAdapter :
    BaseQuickAdapter<WorksBean, BaseViewHolder>(R.layout.app_item_collections_details) {
    override fun convert(holder: BaseViewHolder, item: WorksBean) {
        ImageLoaderUtils.displayRound(
            context,
            holder.getView(R.id.item_iv_img),
            item.coverImages,
            8
        )
        ImageLoaderUtils.displayCircle(context, holder.getView(R.id.item_iv_avatar), item.head)
        holder.setText(R.id.item_tv_content, item.workName)
            .setText(R.id.item_tv_name, item.nickName)
            .setText(R.id.item_tv_collect, item.viewCount)
        holder.itemView.setOnClickListener {
            ARouterUtil.goToActivityWithBundle(AppConstants.Router.WORK.A_WORK_DETAIL,
                Bundle().apply {
                    putString("id", item.id)
                }
            )
        }
    }
}